import {
  throttle
} from '../../utils/util'
Component({
  options: {
    addGlobalClass: true
  },
  /**
   * 组件的属性列表
   */
  properties: {
    dataList: {
      type: Array,
      value: []
    },
    loading: {
      type: Boolean,
      value: false
    },
    withCustomer: { // 如果从客服进来 则要携带 withcustomer = true, 其他地方进来则不需要携带
      type: Boolean,
      value: false
    },
    uid: {
      type: String,
      value: ''
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    jump(e) {
      const {
        productmirrorid = '',
      } = e.currentTarget.dataset;
      throttle(() => {
        this.data.uid && wx.setStorageSync('customerUid', this.data.uid)
        const url = `../detail/detail?productMirrorId=${productmirrorid}&type=1&withCustomer=${this.data.withCustomer}`
        wx.navigateTo({
          url,
        });
      })
    }
  }
})